package com.xiyou.luckdraw.api.dto.user;

import com.xiyou.luckdraw.common.constants.ResultCodeConstants;
import com.xiyou.luckdraw.common.exception.ValidateException;
import com.xiyou.luckdraw.common.result.AbstractRequest;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @ClassName: UserTntegralLogListRequest
 * @Description:
 * @author: limingxing
 * @Date: 2019-10-21 14:57
 */

@Data
@ApiModel(value = "用户兑换劵记录请求参数")
public class UserTntegralLogListRequest extends AbstractRequest {
    private Long userId;

    @ApiModelProperty(value = "页码",example = "1")
    private Integer page;
    @ApiModelProperty(value = "页大小",example = "10")
    private Integer size;



    @Override
    public void requestCheck() {
        if(null == userId){
            throw new ValidateException(
                    ResultCodeConstants.REQUISITE_PARAMETER_NOT_EXIST.getCode(),
                    ResultCodeConstants.REQUISITE_PARAMETER_NOT_EXIST.getMessage());
        }
        if(page == null || page < 1){
            page = 1;
        }
        if(size == null || size < 1){
            size = 10;
        }
    }
}
